<?php
    session_start();
?>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html; charset=UTF-8"> 
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link href="../css/bootstrap.min.css" rel="stylesheet">
        <link rel="shortcut icon" href="../bootstrap/img/favicon.ico">
        
        <title>AC MILAN </title>
        
        <style type="text/css">
            .container {
            margin: 0 auto;
            max-width: 960px;
          }
          
        </style>
        </head>   
             <?php require_once('../modulos/header.php'); ?> 
            <body  style="background-image: url(../img/rayas_verticales.jpg); background-size: 100%;">
                                <nav class="navbar navbar-default" style="background-color: black; border: black; height: 30px;">
                    <div class="container-fluid">
                      <div class="navbar-header">
                        <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                          <span class="sr-only">Navegador</span>
                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                          <span class="icon-bar"></span>
                        </button>
                          <a class="navbar-brand" href="../vistas/index_Admin.php" style="width:200px; height: 50px; background-image: url(../img/logo.jpg); background-size: 180px; background-repeat: no-repeat;"></a>
                      </div>
                        
                        
                        <div id="navbar" class="navbar-collapse collapse">
                          
                          <ul class="nav navbar-nav" style="font-family: 'Tempus Sans ITC';">
                            <li class="active "><a style="color: black;" href="../vistas/index_Admin.php">
                           <span aria-hidden="true"></span>Inicio</a></li>
                        </ul>
                      </div><!--/.nav-collapse -->
                      
                    </div><!--/.container-fluid -->
                    <div style=" height: 15px; background: #BC6D13; "></div>
                <div style=" height: 10px; background: black; "></div> 
                </nav>
                
      <div class='row'>
          <br>
          <br>
          <br>
            <div class="col-md-4 text-center col-lg-offset-4" style="background: #e7e7e7; border-radius: 15px;">
                <?php
                    require_once '../conexLogin.php';
                    
                    if (isset($_GET['error'])){
                        $error = $_GET['error'];
                        if ($error == 1){    
                            echo '<script type= "text/javascript"> alert("ERROR: Usuario no registrado en el sistema. Debe crear una cuenta."); </script>';
                        }else if ($error == 2){
                            echo '<script type= "text/javascript"> alert("ERROR: Clave incorrecta."); </script>';
                        }else if ($error == 3){
                            echo '<script type= "text/javascript"> alert("ERROR: Usuario incorrecto."); </script>';
                        }
                    }
                ?>
                <form id="formulario" class="form-signin" method="POST" action="../insertar/valida_admin.php">
                  <h2 class="form-signin-heading">Iniciar Sesión</h2>
                  <input name="user" type="text" class="form-control" placeholder="Usuario" required autofocus>
                  <br>
                  <input name="clave" type="password" class="form-control" placeholder="Contraseña" required>
                  <br>
                  <a>Olvidé mi contraseña</a>
                  <br>
                  <br>
                  <button class="btn btn-lg btn-primary btn-block" type="submit">Entrar</button>
                  <button class="btn btn-lg btn-success btn-block" onclick="redirect();" type="submit">Crear Cuenta</button>
                </form> 
              </div>           
      </div> 
                
        <script type="text/javascript">
            function redirect(){
                window.location = "crear_cuenta.php";
            }
        </script>          
                
  </body>
</html>